// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   CategoryCreateController.java

package dale.web.category.controller;

import dale.web.category.domain.Category;
import dale.web.category.service.CategoryService;
import org.springframework.validation.BindingResult;

public class CategoryCreateController
{

    public CategoryCreateController(CategoryService service)
    {
        this.service = service;
    }

    public Category get()
    {
        Category category = new Category();
        return category;
    }

    public String post(Category category, BindingResult result)
    {
        if(result.hasErrors())
        {
            return "/category/create";
        } else
        {
            service.create(category);
            return (new StringBuilder("redirect:/category/detail?categoryID=")).append(category.getCategoryID()).toString();
        }
    }

    private CategoryService service;
}
